Contained herein is material that is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction of the patent disclosure by any person as it appears in the Patent and Trademark Office patent files or records, but otherwise reserves all rights to the copyright whatsoever.
1. Field of the Invention
The invention relates generally to the field of operating systems. More particularly, the invention relates to a method that allows a command file to access a data store, such as the Windows Registry, that is accessible only by way of an Application Programming Interface (API).
2. Description of the Related Art
The Windows(copyright) Registry is increasingly used to store application configuration information. Formerly, much of this information was stored in environment variables, which command files (such as files with a .bat or .cmd extensions) could access directly by coding the environment variable name surrounded by percent signs (e.g., xe2x80x9c%MYAPPPATH%xe2x80x9d). However, there is no way for command files to directly access data stored in the Registry.
Previously, three methods could be used to access data stored in the Registry. First, Registry data can be accessed by coding utility functions as programs rather than command files. Another solution is to duplicate information in both the Registry and in permanent environmental variables and use the environmental variables rather than the Registry. Finally, use of the Registry can be avoided and the information stored in permanent environmental variables only. However, each of these approaches has drawbacks.
To provide access to Registry data, utility functions can be coded as programs rather than command files. These programs can then access the Registry data by using the Windows APIs. However, this method is somewhat inefficient. Programs are more difficult and time consuming to write and maintain than command files. Therefore, this method detracts from developer productivity relative to a method that uses command files to access the Registry data.
Another method of providing access to Registry data is to duplicate the Registry data in permanent environmental variables and access these variables through a command file. This method has the disadvantage of requiring that the Registry data and the environmental variables be kept synchronized. However, it may actually be impossible to keep this data synchronized because the user can use mechanisms outside the applications control such as a Registry editor to manipulate the data. Therefore, the user can, either intentionally or inadvertently, create a situation in which the Registry data and the environmental variables are no longer synchronized.
Finally, the problem of accessing the Registry data can be avoided altogether by simply using permanent environmental variables in place of the Registry. As with the method that duplicates the Registry data in environmental variables, this method provides access to the environmental variables through a command file. However, this approach is contrary to Microsoft""s policy of making the Registry the repository for application configuration type information.
According to one aspect of the invention, a method of allowing command files to access information in a data store is provided. This method consists of executing a first, original command file. A second, temporary command file is then created. The temporary command file includes one or more commands based upon information from a data store that is accessible by way of an Application Programming Interface (API). Information from the data store is then used during execution of the temporary command file.
In one embodiment, the original command file defines the scope of temporary environmental variables for storing information to be retrieved from the data store by a command file generator program and stored in the temporary command file, executes the temporary command file, branches around the operations contained in the body of the original command file which have been performed by the temporary command file, and cleans up the local environment. A command file generator, executed by the original command file generates the temporary command file, accesses information from a data stores through Application Programming Interfaces (APIs) associated with the data store, and generates one or more commands for inclusion in the temporary command file based upon the information retrieved from the data store. The temporary command file stores information retrieved from the data store in one or more local environmental variables, and performs processing based upon the content of the environmental variables and the original command file.
Advantageously, this method allows command files to access a data store such as the Windows Registry without some of the problems associated with prior approaches. First, access to the data store can be achieved through a command file which is easier to write and maintain than a program. Secondly, there is no concern about synchronization between the data store and permanent environmental variables used to mimic the data store. Finally, the method allows full use of the data store as intended, that is, as a central repository for configuration type information.